﻿package com.tomvian.maths.areas
{
	import com.tomvian.maths.Vector2D;
	
	/**
	 * PointArea
	 * @author Thomas Vian
	 */
	public class PointArea extends Area
	{
		//--------------------------------------------------------------------------
		//
		//  Properties
		//
		//--------------------------------------------------------------------------
		
		private var _point:Vector2D;
		
		//--------------------------------------------------------------------------
		//
		//  Constructor
		//
		//--------------------------------------------------------------------------
		
		public function PointArea(point:Vector2D)
		{
			_point = point;
			area = 1;
		}
		
		//--------------------------------------------------------------------------
		//
		//  Methods
		//
		//--------------------------------------------------------------------------
		
		override public function contains(vector:Vector2D):Boolean 
		{
			return vector.x == _point.x && vector.y == _point.y;
		}
		
		override public function random():Vector2D 
		{
			return _point.clone();
		}
	}
}